-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(database): add closable connection wrapper for PDO connection #875
base: main
Are you sure you want to change the base?
feat(database): add closable connection wrapper for PDO connection #875
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks great! Can you think of a way to test that the connection is actually closed? 🤔
It depends on your meaning of "test".. I can Add a test for the close functionality: yes. It will just check if the PDO connection has been set to null. I cannot test if the PDO driver really closes the connection, PDO doesn't expose anything for this. Do you want me to add a unit test for the connect + close functionality? |
I think what would be ideal is that the Then, we can write a test that first ensure the connection works by issuing a query, then closing the connection, and finally expecting the exception when issuing another query |
Implemented the exception and the test using sqllite. |
9cc4e2b
to
eb7c7fc
Compare
@brendt I do not know why phpstan fails. It occurred because I rebased my branch on the upstream main branch. The errors are not even the files I changed in this PR, or due to it? Any ideas? |
eb7c7fc
to
3b8009d
Compare
3b8009d
to
7f1ba39
Compare
What
Closes #872
Why
task
component #857 it is sometimes needed to manually close the PDO connection. With this PR you can manually close (and re-connect) the PDO connection.